<?php
include("../../config/config.php");
$identifier = array_key_exists("id",$_GET)?$_GET["id"]:"";
$teste_id = "$identifier";
$nome = "";
$email = "";
$apelido = "";
$habilitado = "";
$sexo = "";
$updated_on = "";
$created_on = "";

if ($identifier != ""){
	// EDIT ITEM
	$action = "EDITAR";

	$DM->loadClass("testePack","testeClass");
	$object_testeClass = new testeClass();
	$object_testeClass->teste_id = $identifier;
	$object_testeClass->getById();
	$teste_id = $object_testeClass->teste_id;
	$nome = $object_testeClass->nome;
	$email = $object_testeClass->email;
	$apelido = $object_testeClass->apelido;
	$habilitado = $object_testeClass->habilitado;
	$sexo = $object_testeClass->sexo;
	$updated_on = $object_testeClass->updated_on;
	$created_on = $object_testeClass->created_on;

}
?>
<html>
<HEAD>
	<link href="<?php echo HTTP_BASE?>/resource/includes/css/admin.css" type="text/css" rel="stylesheet" rev="stylesheet" />
	<script src="<?php echo HTTP_BASE?>/resource/includes/javascript/jquery/jquery-1.2.3.js"></script>
	<script>
		function checkFilled(){
			mySubmit();
		}
		function comboFix(comboName,value){
			var k = document.cont;
			var cm = k[comboName];
			for (var i=0;i<cm.length;i++){
				if (cm[i].value==value){
					cm.selectedIndex=i;
				}
			}
		}
	</script>
</HEAD>
<body bgcolor='#FFFFFF' onload="">	<form action="testeClass.process.php" method="POST" enctype="multipart/form-data" name="cont">
	<table width='100%' cellpadding="3" cellspacing="1" bgcolor="#efefef">
		<tr>
			<td class='titleTd' bgcolor='#ffffff' width="25">TESTECLASS</td>
			<td class='titleTd' bgcolor='#ffffff'><font style='font-wheight:bolder;font-size:11px;'><?php echo $action?></font>
				<input type="hidden" name="teste_id" value="<?php echo $teste_id?>">
			</td>
		</tr>
		<tr>
			<td colspan="2" class='titleTd' bgcolor='#ffffff'>FORM</td>
		</tr>
		<tr>
			<td colspan="2" height="20">&nbsp;</td>
		</tr>
		<tr>
			<td class='line1'>MyID</td>
			<td class='line1'><input type="text"   size="10" class='inputClass' name="teste_id" value="<?php echo $teste_id?>"></td>
		</tr>
		<tr>
			<td class='line2'>Nome</td>
			<td class='line2'><input type="text"  MAXLENGTH="200"  style="width:600px;" class='inputClass' name="nome" value="<?php echo $nome?>"></td>
		</tr>
		<tr>
			<td class='line1'>Email</td>
			<td class='line1'><input type="text"  MAXLENGTH="200"  style="width:600px;" class='inputClass' name="email" value="<?php echo $email?>"></td>
		</tr>
		<tr>
			<td class='line2'>Apelido</td>
			<td class='line2'><input type="text"  MAXLENGTH="200"  style="width:600px;" class='inputClass' name="apelido" value="<?php echo $apelido?>"></td>
		</tr>
		<tr>
			<td class='line1'>Habilitado</td>
			<td class='line1'>
					<input type="radio" class='inputClass' name="habilitado" value="0" <?php echo ($habilitado==0?"checked":"")?>> OFF / 
					<input type="radio" class='inputClass' name="habilitado" value="1" <?php echo ($habilitado==1?"checked":"")?>> ON</td>
		</tr>
		<tr>
			<td class='line2'>Sexo</td>
			<td class='line2'><select class='inputClass' name="sexo">
		<option value='masculino'>masculino</option>
		<option value='feminino'>feminino</option></select></td>
			<script>comboFix("sexo",'<?php echo $sexo?>');</script>
		</tr>
		<tr>
			<td colspan="2" class="line1" align='right'><input type="button" value="CANCELAR" class='minorAction' onclick="history.go(-1);">&nbsp;<input type="button" value="SALVAR" class='minorAction' onclick="checkFilled();"></td>
		</tr>
	</table>
</form>
<script type="text/javascript">
	function mySubmit() {
		document.cont.submit();
	};
</script>
</body>
</html>